package JLB_Chapter_09;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class code_09_15 {
    public static void main(String[] args) {
        System.out.println("----冬奥会倒计时----");
        Date date = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String today = simpleDateFormat.format(date);
        System.out.println("今天是" + today);
        long time1 = date.getTime();
        Calendar calendar = Calendar.getInstance();
        calendar.set(2022, 2-1, 4);
        long time2 = calendar.getTimeInMillis();
        long day = (time2 - time1) / (1000 * 60 * 60 * 24);
        System.out.println("距离2022年北京-张家口冬奥会还有" + day + "天");
    }
}
